/*
* Copyright (c) 2016, Spreadtrum Communications.
*
* The above copyright notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

//#define SPRD_TEST_AES
//#define SPRD_TEST_CMAC
//#define SPRD_TEST_AUTHENC
#define SPRD_TEST_HASH
//#define SPRD_TEST_HMAC
#define SPRD_TEST_RNG
#define SPRD_TEST_RSA
//#define SPRD_TEST_ECC
//#define SPRD_TEST_MULTITASK
//#define SPRD_TEST_MULTITHREAD

#include <sprd_crypto.h>
#ifdef SPRD_TEST_HASH
#include <sprd_hash.h>
#endif
#ifdef SPRD_TEST_AES
#include <sprd_aes.h>
#endif
#if defined(SPRD_TEST_HMAC) | defined(SPRD_TEST_CMAC)
#include <sprd_mac.h>
#endif
#ifdef SPRD_TEST_AUTHENC
#include <sprd_authenc.h>
#endif
#ifdef SPRD_TEST_RNG
#include <sprd_rng.h>
#endif
#ifdef SPRD_TEST_RSA
#include <sprd_rsa.h>
#endif
#ifdef SPRD_TEST_ECC
#include <sprd_ecc.h>
#include "pk/ecc/sprd_ecc_test.h"
#endif

#ifdef SPRD_TEST_MULTITASK
sprd_crypto_err_t
sprd_multitask_test (void *args) {
#ifdef SPRD_TEST_HASH
	static const struct {
		const char *msg;
		unsigned char hash[64];
	} sha_512_test = {
		"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
		"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
		"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
		"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGH",//256B
		{ 0xf5, 0xcb, 0x00, 0xf6, 0x52, 0x6f, 0x43, 0x0f,
		  0xc9, 0x6c, 0x2e, 0xf6, 0x7f, 0xc1, 0x26, 0x4a,
		  0x3f, 0x1d, 0x25, 0x68, 0x85, 0x73, 0xba, 0xc2,
		  0x67, 0x02, 0x1a, 0xa2, 0x96, 0x2a, 0xa5, 0xf0,
		  0xee, 0x30, 0xfd, 0x7a, 0x2f, 0xf8, 0x50, 0x59,
		  0x05, 0x19, 0xbe, 0xa2, 0x39, 0x2d, 0xcc, 0xdb,
		  0x5e, 0x80, 0xf8, 0xec, 0xdf, 0x47, 0xfc, 0x9b,
		  0x42, 0xad, 0x5b, 0xc6, 0xb2, 0xd8, 0xf3, 0xc9, }
	};
#endif
#ifdef SPRD_TEST_HMAC
	static const struct hmac_test_cases {
		uint8_t key[256];
		int32_t key_len;
		uint8_t data[256];
		int32_t data_len;
		uint8_t digest[64];
	} hmac_512_test = {
		{ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
		  0xaa, 0xaa, 0xaa },
		131,
		"This is a test using a larger than block-size key and a larger than block-size data. "
		"The key needs to be hashed before being used by the HMAC algorithm.",
		152,
		{ 0xe3, 0x7b, 0x6a, 0x77, 0x5d, 0xc8, 0x7d, 0xba,
		  0xa4, 0xdf, 0xa9, 0xf9, 0x6e, 0x5e, 0x3f, 0xfd,
		  0xde, 0xbd, 0x71, 0xf8, 0x86, 0x72, 0x89, 0x86,
		  0x5d, 0xf5, 0xa3, 0x2d, 0x20, 0xcd, 0xc9, 0x44,
		  0xb6, 0x02, 0x2c, 0xac, 0x3c, 0x49, 0x82, 0xb1,
		  0x0d, 0x5e, 0xeb, 0x55, 0xc3, 0xe4, 0xde, 0x15,
		  0x13, 0x46, 0x76, 0xfb, 0x6d, 0xe0, 0x44, 0x60,
		  0x65, 0xc9, 0x74, 0x40, 0xfa, 0x8c, 0x6a, 0x58 }
	};
#endif
#ifdef SPRD_TEST_AES
	static const struct {
		int32_t key_len;
		int32_t iv_len;
		int32_t pt_len;
		int32_t padding;
		const uint8_t key[32] __attribute__ ((aligned (8)));
		const uint8_t iv[16] __attribute__ ((aligned (8)));
		const uint8_t pt[192] __attribute__ ((aligned (8)));
		const uint8_t ct[192] __attribute__ ((aligned (8)));
	} aes_cbc_test = {
		32, 16, 192, SPRD_SYM_NOPAD,
		{ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
		  0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
		  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
		  0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, },
		{ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
		  0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, },
		{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
		  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		  0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
		  0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
		  0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
		  0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
		  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
		  0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
		  0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
		  0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
		  0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
		  0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
		  0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
		  0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
		  0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
		  0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
		  0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
		  0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
		  0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
		  0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
		  0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
		  0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
		  0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
		  0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, },
		{ 0x30, 0x22, 0x50, 0x58, 0x7d, 0x12, 0x12, 0xb8,
		  0xd3, 0x4d, 0x0d, 0x9b, 0x4c, 0xd9, 0x95, 0xcb,
		  0xd2, 0x18, 0xff, 0x44, 0xd6, 0xb1, 0x0a, 0x5a,
		  0xf4, 0x54, 0x98, 0x23, 0xcb, 0xc8, 0xc8, 0xa2,
		  0x4d, 0x42, 0x5f, 0x66, 0x36, 0xf6, 0x50, 0x82,
		  0xdd, 0xf3, 0x49, 0x80, 0x5d, 0x71, 0x03, 0xd3,
		  0x1b, 0x65, 0xfd, 0xb1, 0x6a, 0xcd, 0x8c, 0xc4,
		  0x8c, 0x20, 0xa7, 0x26, 0x77, 0x06, 0x4e, 0xc5,
		  0x94, 0x62, 0xae, 0xe8, 0xeb, 0x1d, 0x9c, 0xb1,
		  0xa4, 0xb1, 0x09, 0x71, 0xdd, 0xcd, 0x12, 0xd1,
		  0x1c, 0xc6, 0x10, 0x80, 0xf4, 0x2e, 0x3c, 0xab,
		  0x06, 0x78, 0xeb, 0x33, 0xe2, 0xe5, 0xdf, 0xe7,
		  0x30, 0x29, 0x24, 0x7e, 0x8e, 0x03, 0x65, 0xf9,
		  0x9f, 0xf7, 0x4f, 0x28, 0xb5, 0x7a, 0x21, 0xac,
		  0x99, 0x02, 0xfd, 0x9f, 0xdf, 0xab, 0x4c, 0xc3,
		  0xca, 0x84, 0xe0, 0x65, 0x5a, 0xd2, 0x8e, 0xd4,
		  0x34, 0x57, 0x83, 0xd0, 0x13, 0x1f, 0xdf, 0x17,
		  0xe2, 0x90, 0xef, 0xdb, 0xbc, 0x4e, 0xfb, 0x4d,
		  0x4c, 0x6c, 0x09, 0xea, 0x4d, 0x40, 0xdb, 0x2c,
		  0xea, 0x5e, 0xaa, 0x65, 0x80, 0x66, 0x8e, 0x61,
		  0x01, 0x07, 0x3a, 0x35, 0x0d, 0xea, 0x6a, 0x20,
		  0xe7, 0xd4, 0x3a, 0xe2, 0x9c, 0xb2, 0x2b, 0xc4,
		  0xe0, 0x34, 0xd0, 0x8b, 0x6c, 0xf9, 0x0d, 0xb9,
		  0x1b, 0x06, 0x48, 0xef, 0x8d, 0x50, 0xed, 0xfc, },
	};
#endif
#ifdef SPRD_TEST_RSA
	static struct {
		uint32_t data_len;
		uint8_t key_n[512];
		uint8_t key_e[4];
		uint8_t key_d[512];
		uint8_t din[512];
		uint8_t dout[512];
	} rsa_test = {
		//4096
		512,
		//n
		{ 0x75, 0x55, 0x2F, 0xF8, 0x78, 0x92, 0x38, 0xAA, 0xE6, 0xE0, 0x87, 0x4B, 0xB1, 0xFC, 0x3B, 0x91,
		  0x54, 0x0B, 0x04, 0xC2, 0xBC, 0x31, 0xE2, 0xB7, 0x5B, 0x05, 0x22, 0x22, 0x7C, 0x02, 0x72, 0x9E,
		  0xD1, 0x3E, 0x5C, 0x60, 0x02, 0xB5, 0xDE, 0xD2, 0x56, 0xC6, 0xDF, 0x49, 0x33, 0x5B, 0xA4, 0x1E,
		  0x89, 0xAD, 0x5F, 0xF0, 0x6D, 0x61, 0xEC, 0x0B, 0xDE, 0x55, 0xAA, 0x21, 0xFC, 0x13, 0x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 0x1A, 0x3B, 0xC2, 0xB3,
		  0x5A, 0x30, 0x41, 0xA4, 0x25, 0xD2, 0x56, 0x62, 0x0A, 0x49, 0xB0, 0x91, 0x11, 0xB2, 0x08, 0x04,
		  0xC6, 0x24, 0x80, 0x85, 0x30, 0xEE, 0xA9, 0xC0, 0xB6, 0xB5, 0xF5, 0xC9, 0x9F, 0x02, 0xE5, 0x67,
		  0x32, 0x22, 0x60, 0x34, 0x32, 0x4D, 0x31, 0x8F, 0x3D, 0x9A, 0xF0, 0xB8, 0x92, 0x23, 0x6A, 0xF1, },
		//out
		{ 0x28, 0x38, 0x67, 0xE9, 0x39, 0x91, 0xF5, 0xEE, 0x77, 0x78, 0x99, 0xA6, 0x47, 0x82, 0x64, 0xC4,
		  0x37, 0x62, 0xBD, 0xB5, 0xC8, 0x12, 0xDB, 0xE3, 0x1E, 0xC3, 0xA2, 0xB9, 0xF1, 0xA7, 0xD3, 0xB1,
		  0x1C, 0xAD, 0x9E, 0xDF, 0x6C, 0xCE, 0xE6, 0x7C, 0xD0, 0x7F, 0xBD, 0xE0, 0x7A, 0x94, 0x8D, 0xA0,
		  0xFF, 0x5C, 0x96, 0x34, 0x86, 0xB4, 0xD7, 0x1B, 0x1E, 0xAF, 0x55, 0x44, 0x92, 0x23, 0x14, 0x11,
		  0xF5, 0x0A, 0xA0, 0xF6, 0x54, 0xB9, 0x40, 0x57, 0x79, 0x99, 0x9C, 0x32, 0x54, 0x32, 0xB6, 0x65,
		  0x8D, 0x0D, 0x11, 0x5A, 0x50, 0xD8, 0xDA, 0x8C, 0xCC, 0x67, 0x61, 0xAB, 0xD0, 0xD7, 0xE5, 0x4F,
		  0xA3, 0x04, 0x22, 0x6C, 0x51, 0xE0, 0x4C, 0x25, 0x16, 0x50, 0x42, 0x14, 0x8B, 0xE4, 0xE6, 0xEB,
		  0x94, 0xB4, 0x9F, 0x2D, 0x46, 0x98, 0x84, 0x62, 0xD6, 0x5E, 0xA4, 0x23, 0x51, 0x40, 0xF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74, 0x84, 0x62, 0xA6, 0x80, 0x90, 0x58, 0x7D, 0xB8, 0x67, 0x11, 0xF8, 0x23,
		  0xDB, 0x4B, 0xA8, 0xC1, 0x1D, 0x4F, 0xAB, 0xF2, 0x7E, 0x34, 0xA6, 0xE7, 0x0E, 0xC0, 0xF4, 0x21, },
	};
#endif
#ifdef SPRD_TEST_CMAC
	static const struct cmac_test_cases {
		uint8_t key[32];
		uint32_t  key_len;
		uint8_t data[64];
		uint32_t  data_len;
		uint8_t digest[16];
	} cmac_test = {
		{ 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
		  0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
		  0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
		  0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4 },
		32,
		{ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
		  0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
		  0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
		  0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
		  0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
		  0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
		  0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
		  0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
		64,
		{ 0xe1, 0x99, 0x21, 0x90, 0x54, 0x9f, 0x6e, 0xd5,
		  0x69, 0x6a, 0x2c, 0x05, 0x6c, 0x31, 0x54, 0x10 },
	};
#endif
#ifdef SPRD_TEST_AUTHENC
	static const struct gcm_test_cases {
		uint8_t  key[32];
		uint32_t key_len;
		uint8_t  nonce[128];
		uint32_t nonce_len;
		uint8_t  aad[24];
		uint32_t aad_len;
		uint8_t  pt[64];
		uint8_t  ct[64];
		uint32_t len;
		uint8_t  tag[16];
	} gcm_test = {
		//case 18
		{ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
		  0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
		  0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
		  0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08 },
		32,
		{ 0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5,
		  0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa,
		  0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1,
		  0xe4, 0xc3, 0x03, 0xd2, 0xa3, 0x18, 0xa7, 0x28,
		  0xc3, 0xc0, 0xc9, 0x51, 0x56, 0x80, 0x95, 0x39,
		  0xfc, 0xf0, 0xe2, 0x42, 0x9a, 0x6b, 0x52, 0x54,
		  0x16, 0xae, 0xdb, 0xf5, 0xa0, 0xde, 0x6a, 0x57,
		  0xa6, 0x37, 0xb3, 0x9b },
		60,
		{ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
		  0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
		  0xab, 0xad, 0xda, 0xd2 },
		20,
		{ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
		  0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
		  0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
		  0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
		  0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
		  0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
		  0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
		  0xba, 0x63, 0x7b, 0x39 },
		{ 0x5a, 0x8d, 0xef, 0x2f, 0x0c, 0x9e, 0x53, 0xf1,
		  0xf7, 0x5d, 0x78, 0x53, 0x65, 0x9e, 0x2a, 0x20,
		  0xee, 0xb2, 0xb2, 0x2a, 0xaf, 0xde, 0x64, 0x19,
		  0xa0, 0x58, 0xab, 0x4f, 0x6f, 0x74, 0x6b, 0xf4,
		  0x0f, 0xc0, 0xc3, 0xb7, 0x80, 0xf2, 0x44, 0x45,
		  0x2d, 0xa3, 0xeb, 0xf1, 0xc5, 0xd8, 0x2c, 0xde,
		  0xa2, 0x41, 0x89, 0x97, 0x20, 0x0e, 0xf8, 0x2e,
		  0x44, 0xae, 0x7e, 0x3f },
		60,
		{ 0xa4, 0x4a, 0x82, 0x66, 0xee, 0x1c, 0x8e, 0xb0,
		  0xc8, 0xb5, 0xd4, 0xcf, 0x5a, 0xe9, 0xf1, 0x9a },
	};
#endif
#ifdef SPRD_TEST_ECC
	static struct ecc_test_st {
		uint32_t  ecc_px    [SPRD_ECC_CURVE_MAX_WORD_LENGTH];
		uint32_t  ecc_py    [SPRD_ECC_CURVE_MAX_WORD_LENGTH];
		uint32_t  ecc_d     [SPRD_ECC_CURVE_MAX_WORD_LENGTH];
		uint32_t  ecc_r     [SPRD_ECC_CURVE_MAX_WORD_LENGTH];
		uint32_t  ecc_s     [SPRD_ECC_CURVE_MAX_WORD_LENGTH];
		uint32_t  ecc_mhash [SPRD_ECC_CURVE_MAX_WORD_LENGTH];
		uint8_t   pxy_bytelen;
		uint8_t   d_bytelen;
		uint8_t   r_bytelen;
		uint8_t   s_bytelen;
		uint8_t   mhash_bytelen;
		uint8_t   p_bytelen;
		uint8_t   n_bytelen;
		sprd_ecc_curveid_t  ecc_curve;
	} ecc_test = {
		{0xa01b4935, 0x0a050048, 0x7d8d5385, 0x4bbbd922, 0x189943ac, 0x25505633, 0xf3eace0f, 0x3068717d, 0x1f831140, 0x621a046c, 0xf9469078, 0x6f11d0cc, 0xb1df1ebf, 0x486be9cc, 0x2661893d, 0x9d94a9fe, 0x0000002a,},
		{0xf116cce7, 0x1087c683, 0x20c0f57b, 0xc80fc8c9, 0x9ae7e662, 0xf58ea4a6, 0x8f9c270c, 0xa7c72977, 0x284c7be3, 0xd4a3074c, 0xd44866de, 0xc5af6979, 0xdeb04394, 0x873eb8fc, 0x8ff65c0e, 0x1e7334c7, 0x0000003f,},
		{0xfbd854a7, 0xae66f518, 0x31918a30, 0x6787e478, 0x766f6a2e, 0x1de0b844, 0x6bea4d41, 0xed86969b, 0x3ec6ed3c, 0x98b93704, 0x78b5af77, 0x76643f50, 0xfb2aba84, 0x9f0653e5, 0xa308751c, 0x964a8683, 0x000001c1,},
		{0x0d1bd38a, 0x507d37bd, 0xfcd8d07e, 0xfca8bbba, 0x971887b9, 0xc7c39b0a, 0x74a52d87, 0x1aa702b2, 0x9b0cb0cf, 0x0602b0fa, 0x1d52e6f5, 0x7cd05fc2, 0xd27cdad4, 0xf70a4ee5, 0x2fb7e3ee, 0x700dfcd6, 0x00000142,},
		{0xe2874203, 0x68ac3381, 0xb8652a5c, 0xd54b9a1f, 0xb216f19e, 0x6275a447, 0x0d30132f, 0x91621b81, 0x8a932444, 0xf5df4cb2, 0xcf6c59ba, 0x93bd7c2d, 0xd2fd5ee2, 0xadaab2e6, 0xb30dce0e, 0x42328c10, 0x000001be,},
		{0x9cd0d89d, 0x7850c26c, 0xba3e2571, 0x4706816a, 0xa9993e36,},
	        68,
	        68,
	        68,
	        68,
		20,
		68,
		68,
		SPRD_ECC_CurveID_secp521r1,
	};
#endif

	sprd_crypto_err_t err = SPRD_CRYPTO_SUCCESS;
#ifdef SPRD_TEST_HASH
	sprd_crypto_context_t *sha_512 = NULL;
	uint8_t *hash_temp = NULL;
#endif
#ifdef SPRD_TEST_AES
	sprd_crypto_context_t *aes_cbc = NULL;
	uint8_t *aes_temp = NULL;
#endif
#ifdef SPRD_TEST_HMAC
	sprd_crypto_context_t *hmac_512 = NULL;
	uint8_t *hmac_temp = NULL;
#endif
#ifdef SPRD_TEST_CMAC
	sprd_crypto_context_t *cmac = NULL;
	uint8_t *cmac_temp = NULL;
#endif
#ifdef SPRD_TEST_AUTHENC
	sprd_crypto_context_t *gcm = NULL;
	uint8_t *gcm_tag_temp = NULL, *gcm_temp = NULL;
	uint32_t gcm_len_temp, gcm_tag_len;
#endif
#ifdef SPRD_TEST_RNG
	uint8_t *rng_temp = NULL;
#endif
#ifdef SPRD_TEST_RSA
	uint8_t *rsa_temp = NULL, *rsa_key_temp = NULL;
	sprd_rsa_pubkey_t rsa_pub_key;
	sprd_rsa_padding_t padding;
#endif
#ifdef SPRD_TEST_ECC
	uint32_t ecc_out;
	sprd_ecc_pubkey_t ecc_public_key;
	sprd_ecc_signature_t rs;
#endif
	int32_t thread_count = *(int32_t*)args;

#ifdef SPRD_TEST_HASH
	sha_512 = sprd_pal_malloc(sizeof(sprd_crypto_context_t));
	if (sha_512 == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}

	hash_temp = sprd_pal_malloc(64);
	if (hash_temp == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}
	sprd_pal_memset(hash_temp, 0, 64);
#endif
#ifdef SPRD_TEST_AES
	aes_cbc = sprd_pal_malloc(sizeof(sprd_crypto_context_t));
	if (aes_cbc == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}

	aes_temp = sprd_pal_malloc(192);
	if (aes_temp == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}
	sprd_pal_memset(aes_temp, 0, 192);
#endif
#ifdef SPRD_TEST_HMAC
	hmac_512 = sprd_pal_malloc(sizeof(sprd_crypto_context_t));
	if (hmac_512 == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}

	hmac_temp = sprd_pal_malloc(64);
	if (hmac_temp == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}
	sprd_pal_memset(hmac_temp, 0, 64);
#endif
#ifdef SPRD_TEST_CMAC
	cmac = sprd_pal_malloc(sizeof(sprd_crypto_context_t));
	if (cmac == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}

	cmac_temp = sprd_pal_malloc(16);
	if (cmac_temp == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}
	sprd_pal_memset(cmac_temp, 0, 16);
#endif
#ifdef SPRD_TEST_AUTHENC
	gcm = sprd_pal_malloc(sizeof(sprd_crypto_context_t));
	if (gcm == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}

	gcm_tag_temp = sprd_pal_malloc(16);
	if (gcm_tag_temp == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}
	sprd_pal_memset(gcm_tag_temp, 0, 16);

	gcm_temp = sprd_pal_malloc(64);
	if (gcm_temp == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}
	sprd_pal_memset(gcm_temp, 0, 64);
#endif
#ifdef SPRD_TEST_RNG
	rng_temp = sprd_pal_malloc(8192);
	if (rng_temp == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}
	sprd_pal_memset(rng_temp, 0, 8192);
#endif
#ifdef SPRD_TEST_RSA
	rsa_temp = sprd_pal_malloc(512);
	if (rsa_temp == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}
	sprd_pal_memset(rsa_temp, 0, 512);

	rsa_key_temp = sprd_pal_malloc(1024);
	if (rsa_key_temp == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}
	sprd_pal_memset(rsa_key_temp, 0, 1024);
#endif

#ifdef SPRD_TEST_HASH
	sprd_hash_init(SPRD_CRYPTO_HASH_SHA512, sha_512);
#endif
#ifdef SPRD_TEST_AES
	err = sprd_aes_init(SPRD_CRYPTO_AES_CBC, SPRD_CRYPTO_ENC, aes_cbc,
				aes_cbc_test.key, NULL, aes_cbc_test.key_len,
				aes_cbc_test.iv, aes_cbc_test.iv_len);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: sprd_aes_init test failed [0x%x]\n", thread_count, err);
		goto failed;
	}
#endif
#ifdef SPRD_TEST_HMAC
	sprd_hmac_init(SPRD_CRYPTO_HMAC_SHA512, hmac_512_test.key, hmac_512_test.key_len, hmac_512);
#endif
#ifdef SPRD_TEST_CMAC
	sprd_cmac_init(SPRD_CRYPTO_AES_CMAC, cmac_test.key, cmac_test.key_len, cmac);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: sprd_cmac_init test failed [0x%x]\n", thread_count, err);
		goto failed;
	}
#endif
#ifdef SPRD_TEST_AUTHENC
	err = sprd_authenc_init(SPRD_CRYPTO_AES_GCM, SPRD_CRYPTO_ENC, gcm_test.key, gcm_test.key_len,
			gcm_test.nonce, gcm_test.nonce_len, 16, 0, 0, gcm);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: sprd_gcm_init test failed [0x%x]\n", thread_count, err);
		goto failed;
	}
#endif



/*****************************************************************************/
#ifdef SPRD_TEST_HASH
	sprd_hash_update(sha_512, (uint8_t *)sha_512_test.msg, 128);
#endif
#ifdef SPRD_TEST_AES
	err = sprd_aes_process(aes_cbc, aes_cbc_test.pt, aes_temp, 128);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: aes_cbc encrypt test FAILED[0x%x]\n", thread_count, err);
		return SPRD_CRYPTO_ERR_RESULT;
	}
#endif
#ifdef SPRD_TEST_RSA
	rsa_pub_key.n = rsa_test.key_n;
	rsa_pub_key.n_len = rsa_test.data_len;
	rsa_pub_key.e = rsa_test.key_e;
	rsa_pub_key.e_len = 4;
	padding.type = SPRD_RSA_NOPAD;
	err = sprd_rsa_public_encrypt(&rsa_pub_key,
			rsa_test.din, rsa_test.data_len,
			rsa_temp, NULL,
			padding);
	if (err != SPRD_CRYPTO_SUCCESS
		|| sprd_pal_memcmp(rsa_temp, rsa_test.dout, rsa_test.data_len) != 0) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: rsa 4096 test FAILED[err = 0x%x]\n", thread_count, err);
		err = SPRD_CRYPTO_ERR_RESULT;
		goto failed;
	}
#endif
#ifdef SPRD_TEST_HMAC
	sprd_hmac_update(hmac_512, hmac_512_test.data, hmac_512_test.data_len);
#endif
#ifdef SPRD_TEST_RNG
	err = sprd_rng_gen(rng_temp, 8192);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: rng test FAILED[err = %d]\n", thread_count, err);
		goto failed;
	}
	SPRD_CRYPTO_LOG_TRACE("&buf[0] = %p, &buf[len_temp] = %p, len_temp = %d\n", &rng_temp[0], &rng_temp[4096], 4096);
	if (sprd_pal_memcmp(&rng_temp[0], &rng_temp[4096], 4096) == 0) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: rng test memcmp FAILED\n", thread_count);
		err = SPRD_CRYPTO_ERR_RESULT;
		goto failed;
	}
#endif
#ifdef SPRD_TEST_CMAC
	err = sprd_cmac_update(cmac, cmac_test.data, cmac_test.data_len);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: sprd_cmac_update test failed [0x%x]\n", thread_count, err);
		goto failed;
	}
#endif
#ifdef SPRD_TEST_AUTHENC
	err = sprd_authenc_update_aad(gcm, gcm_test.aad, gcm_test.aad_len);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: sprd_gcm_init test failed [0x%x]\n", thread_count, err);
		goto failed;
	}
#endif
#ifdef SPRD_TEST_ECC
	sprd_pal_memset(ecc_public_key.pubkey_x, 0, ecc_test.p_bytelen);
	sprd_pal_memcpy(ecc_public_key.pubkey_x, ecc_test.ecc_px, ecc_test.pxy_bytelen);
	sprd_pal_memset(ecc_public_key.pubkey_y, 0, ecc_test.p_bytelen);
	sprd_pal_memcpy(ecc_public_key.pubkey_y, ecc_test.ecc_py, ecc_test.pxy_bytelen);
	sprd_pal_memset(rs.ecc_r, 0, ecc_test.n_bytelen);
	sprd_pal_memcpy(rs.ecc_r, ecc_test.ecc_r, ecc_test.r_bytelen);
	sprd_pal_memset(rs.ecc_s, 0, ecc_test.n_bytelen);
	sprd_pal_memcpy(rs.ecc_s, ecc_test.ecc_s, ecc_test.s_bytelen);
	err = sprd_ecc_verify(SPRD_ECC_CurveID_secp521r1, &ecc_public_key, (uint8_t*)ecc_test.ecc_mhash, ecc_test.mhash_bytelen, &rs, &ecc_out);
	if (err || ecc_out) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: sprd_ecc_verify test FAILED\n", thread_count);
		err = SPRD_CRYPTO_ERR_RESULT;
		goto failed;
	}
#endif


/*****************************************************************************/
#ifdef SPRD_TEST_HASH
	sprd_hash_update(sha_512, (uint8_t *)sha_512_test.msg+128, 128);
#endif
#ifdef SPRD_TEST_AES
	err = sprd_aes_process(aes_cbc, aes_cbc_test.pt+128, aes_temp+128, 64);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: aes_cbc encrypt test FAILED\n", thread_count);
		goto failed;
	}
#endif
#ifdef SPRD_TEST_RSA
/*	rsa_temp[0] = rsa_test.key_e[3];
	rsa_temp[1] = rsa_test.key_e[2];
	rsa_temp[2] = rsa_test.key_e[1];
	rsa_temp[3] = rsa_test.key_e[0];
	err = sprd_rsa_key_gen(rsa_temp, 4,
			rsa_test.data_len,
			rsa_key_temp, rsa_key_temp+512);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: sprd_rsa_key_gen test failed [0x%x]\n", thread_count, err);
		goto failed;
	}*/
#endif
#ifdef SPRD_TEST_AUTHENC
	gcm_len_temp = 64;
	err = sprd_authenc_process(gcm, gcm_test.pt, gcm_test.len, gcm_temp, &gcm_len_temp);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: sprd_authenc_process test failed [0x%x]\n", thread_count, err);
		goto failed;
	}
#endif


/*****************************************************************************/
#ifdef SPRD_TEST_HASH
	sprd_hash_final(sha_512, hash_temp);
	if (sprd_pal_memcmp(hash_temp, sha_512_test.hash, 64) != 0) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: sha_512 test FAILED\n", thread_count);
		err = SPRD_CRYPTO_ERR_RESULT;
		goto failed;
	}
#endif
#ifdef SPRD_TEST_AES
	err = sprd_aes_final(aes_cbc, NULL, 0, NULL, NULL, SPRD_SYM_NOPAD);
	if (err != SPRD_CRYPTO_SUCCESS
		|| sprd_pal_memcmp(aes_temp, aes_cbc_test.ct, aes_cbc_test.pt_len) != 0) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: aes_cbc encrypt test FAILED[0x%x] aes_temp = %p\n", thread_count, err, aes_temp);
		err = SPRD_CRYPTO_ERR_RESULT;
		goto failed;
	}
#endif
#ifdef SPRD_TEST_HMAC
	sprd_hmac_final(hmac_512, hmac_temp);
	if (sprd_pal_memcmp(hmac_temp, hmac_512_test.digest, 64) != 0) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: hmac_sha512 test FAILED\n", thread_count);
		err = SPRD_CRYPTO_ERR_RESULT;
		goto failed;
	}
#endif
#ifdef SPRD_TEST_CMAC
	err = sprd_cmac_final(cmac, cmac_temp);
	if (err != SPRD_CRYPTO_SUCCESS
		|| sprd_pal_memcmp(cmac_temp, cmac_test.digest, 16) != 0) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: aes_cmac test FAILED[0x%x] cmac_temp = %p\n", thread_count, err, cmac_temp);
		err = SPRD_CRYPTO_ERR_RESULT;
		goto failed;
	}
#endif
#ifdef SPRD_TEST_AUTHENC
	gcm_len_temp = 64 - gcm_len_temp;
	gcm_tag_len = 16;
	err = sprd_authenc_finish(gcm, NULL, 0, gcm_temp+64-gcm_len_temp, &gcm_len_temp, gcm_tag_temp, &gcm_tag_len, NULL);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: sprd_gcm_init test failed [0x%x]\n", thread_count, err);
		goto failed;
	}
	if (sprd_pal_memcmp(gcm_tag_temp, gcm_test.tag, 16) != 0) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: aes_gcm test tag FAILED\n", thread_count);
		err = SPRD_CRYPTO_ERR_RESULT;
		goto failed;
	}
	if (gcm_test.len != 0 && sprd_pal_memcmp(gcm_temp, gcm_test.ct, gcm_test.len)) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: aes_gcm test ct FAILED\n", thread_count);
		err = SPRD_CRYPTO_ERR_RESULT;
		goto failed;
	}
#endif

failed:
#ifdef SPRD_TEST_HASH
	if (sha_512 != NULL) {
		sprd_pal_free(sha_512);
		sha_512 = NULL;
	}

	if (hash_temp != NULL) {
		sprd_pal_free(hash_temp);
		hash_temp = NULL;
	}
#endif
#ifdef SPRD_TEST_AES
	if (aes_cbc != NULL) {
		sprd_pal_free(aes_cbc);
		aes_cbc = NULL;
	}

	if (aes_temp != NULL) {
		sprd_pal_free(aes_temp);
		aes_temp = NULL;
	}
#endif
#ifdef SPRD_TEST_HMAC
	if (hmac_512 != NULL) {
		sprd_pal_free(hmac_512);
		hmac_512 = NULL;
	}

	if (hmac_temp != NULL) {
		sprd_pal_free(hmac_temp);
		hmac_temp = NULL;
	}
#endif
#ifdef SPRD_TEST_CMAC
	if (cmac != NULL) {
		sprd_pal_free(cmac);
		cmac = NULL;
	}

	if (cmac_temp != NULL) {
		sprd_pal_free(cmac_temp);
		cmac_temp = NULL;
	}
#endif
#ifdef SPRD_TEST_AUTHENC
	if (gcm != NULL) {
		sprd_pal_free(gcm);
		gcm = NULL;
	}

	if (gcm_tag_temp != NULL) {
		sprd_pal_free(gcm_tag_temp);
		gcm_tag_temp = NULL;
	}

	if (gcm_temp != NULL) {
		sprd_pal_free(gcm_temp);
		gcm_temp = NULL;
	}
#endif
#ifdef SPRD_TEST_RNG
	if (rng_temp !=NULL) {
		sprd_pal_free(rng_temp);
		rng_temp = NULL;
	}
#endif
#ifdef SPRD_TEST_RSA
	if (rsa_temp != NULL) {
		sprd_pal_free(rsa_temp);
		rsa_temp = NULL;
	}

	if (rsa_key_temp != NULL) {
		sprd_pal_free(rsa_key_temp);
		rsa_key_temp = NULL;
	}
#endif

	if (err == SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_TRACE("multi task %d: pass\n", thread_count);
	} else {
		SPRD_CRYPTO_LOG_TRACE("multi task %d: FAILED\n", thread_count);
	}

	return err;
}

sprd_crypto_err_t
sprd_multitask_test_special (void *args) {
	static struct {
		uint32_t data_len;
		uint8_t key_n[512];
		uint8_t key_e[4];
		uint8_t key_d[512];
		uint8_t din[512];
		uint8_t dout[512];
	} rsa_test = {
		//4096
		512,
		//n
		{ 0x75, 0x55, 0x2F, 0xF8, 0x78, 0x92, 0x38, 0xAA, 0xE6, 0xE0, 0x87, 0x4B, 0xB1, 0xFC, 0x3B, 0x91,
		  0x54, 0x0B, 0x04, 0xC2, 0xBC, 0x31, 0xE2, 0xB7, 0x5B, 0x05, 0x22, 0x22, 0x7C, 0x02, 0x72, 0x9E,
		  0xD1, 0x3E, 0x5C, 0x60, 0x02, 0xB5, 0xDE, 0xD2, 0x56, 0xC6, 0xDF, 0x49, 0x33, 0x5B, 0xA4, 0x1E,
		  0x89, 0xAD, 0x5F, 0xF0, 0x6D, 0x61, 0xEC, 0x0B, 0xDE, 0x55, 0xAA, 0x21, 0xFC, 0x13, 0x95, 0xC5,
		  0x65, 0x66, 0x7A, 0xCE, 0x89, 0x2D, 0xBB, 0x4E, 0x6B, 0x71, 0xED, 0xC8, 0xC6, 0x35, 0xB1, 0xB4,
		  0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, 0xD7, 0xE4, 0x7E, 0xA1, 0x1A, 0x3B, 0xC2, 0xB3,
		  0x5A, 0x30, 0x41, 0xA4, 0x25, 0xD2, 0x56, 0x62, 0x0A, 0x49, 0xB0, 0x91, 0x11, 0xB2, 0x08, 0x04,
		  0xC6, 0x24, 0x80, 0x85, 0x30, 0xEE, 0xA9, 0xC0, 0xB6, 0xB5, 0xF5, 0xC9, 0x9F, 0x02, 0xE5, 0x67,
		  0x32, 0x22, 0x60, 0x34, 0x32, 0x4D, 0x31, 0x8F, 0x3D, 0x9A, 0xF0, 0xB8, 0x92, 0x23, 0x6A, 0xF1, },
		//in
		{ 0x2C, 0xC3, 0x04, 0xFB, 0xFB, 0xB3, 0x7C, 0xDE, 0xE6, 0x19, 0x7E, 0x44, 0x08, 0x70, 0xBB, 0xA0,
		  0xE3, 0xB9, 0x18, 0x65, 0xDA, 0x3A, 0x05, 0xCE, 0x01, 0x71, 0x61, 0xE6, 0x59, 0xFC, 0xED, 0x11,
		  0x5D, 0xAE, 0x36, 0xBB, 0x82, 0x0D, 0x34, 0x26, 0x76, 0x68, 0x84, 0x42, 0x7E, 0xCF, 0x55, 0x3B,
		  0x39, 0x36, 0xE5, 0x44, 0xE9, 0xD5, 0xD3, 0xA1, 0x6B, 0x7E, 0xAE, 0xDB, 0x2C, 0x39, 0xA4, 0x87,
		  0x9B, 0xF9, 0x8E, 0x9C, 0x40, 0x85, 0x2B, 0xD1, 0xEC, 0xF7, 0x97, 0xC9, 0x62, 0xA4, 0x95, 0x58,
		  0xCF, 0x73, 0x7B, 0xAE, 0x26, 0x51, 0x80, 0xCE, 0x74, 0x8D, 0xD3, 0x33, 0xB0, 0x25, 0x32, 0xE3,
		  0x78, 0x81, 0xFA, 0xEA, 0xE4, 0x75, 0x65, 0xC4, 0xCA, 0x3B, 0xE2, 0xE9, 0x27, 0x12, 0x22, 0x29,
		  0x6E, 0x04, 0xFF, 0x49, 0x23, 0x11, 0x7C, 0x2B, 0xF5, 0xBF, 0xF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x08, 0x04,
		  0xC6, 0x24, 0x80, 0x85, 0x30, 0xEE, 0xA9, 0xC0, 0xB6, 0xB5, 0xF5, 0xC9, 0x9F, 0x02, 0xE5, 0x67,
		  0x32, 0x22, 0x60, 0x34, 0x32, 0x4D, 0x31, 0x8F, 0x3D, 0x9A, 0xF0, 0xB8, 0x92, 0x23, 0x6A, 0xF1, },
		//out
		{ 0x28, 0x38, 0x67, 0xE9, 0x39, 0x91, 0xF5, 0xEE, 0x77, 0x78, 0x99, 0xA6, 0x47, 0x82, 0x64, 0xC4,
		  0x37, 0x62, 0xBD, 0xB5, 0xC8, 0x12, 0xDB, 0xE3, 0x1E, 0xC3, 0xA2, 0xB9, 0xF1, 0xA7, 0xD3, 0xB1,
		  0x1C, 0xAD, 0x9E, 0xDF, 0x6C, 0xCE, 0xE6, 0x7C, 0xD0, 0x7F, 0xBD, 0xE0, 0x7A, 0x94, 0x8D, 0xA0,
		  0xFF, 0x5C, 0x96, 0x34, 0x86, 0xB4, 0xD7, 0x1B, 0x1E, 0xAF, 0x55, 0x44, 0x92, 0x23, 0x14, 0x11,
		  0xF5, 0x0A, 0xA0, 0xF6, 0x54, 0xB9, 0x40, 0x57, 0x79, 0x99, 0x9C, 0x32, 0x54, 0x32, 0xB6, 0x65,
		  0x8D, 0x0D, 0x11, 0x5A, 0x50, 0xD8, 0xDA, 0x8C, 0xCC, 0x67, 0x61, 0xAB, 0xD0, 0xD7, 0xE5, 0x4F,
		  0xA3, 0x04, 0x22, 0x6C, 0x51, 0xE0, 0x4C, 0x25, 0x16, 0x50, 0x42, 0x14, 0x8B, 0xE4, 0xE6, 0xEB,
		  0x94, 0xB4, 0x9F, 0x2D, 0x46, 0x98, 0x84, 0x62, 0xD6, 0x5E, 0xA4, 0x23, 0x51, 0x40, 0xF2, 0xF9,
		  0xB5, 0x53, 0x74, 0x13, 0x0B, 0xEF, 0xC6, 0x71, 0x42, 0x99, 0xA7, 0xDB, 0xC1, 0xED, 0xA9, 0xB3,
		  0x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 0xAB, 0xF2, 0x7E, 0x34, 0xA6, 0xE7, 0x0E, 0xC0, 0xF4, 0x21, },
	};

	sprd_crypto_err_t err = SPRD_CRYPTO_SUCCESS;
	uint8_t *rsa_temp = NULL;
	int32_t thread_count = *(int32_t*)args;

	rsa_temp = sprd_pal_malloc(512);
	if (rsa_temp == NULL) {
		err = SPRD_CRYPTO_OUTOFMEM;
		goto failed;
	}
	sprd_pal_memset(rsa_temp, 0, 512);

	rsa_temp[0] = rsa_test.key_e[3];
	rsa_temp[1] = rsa_test.key_e[2];
	rsa_temp[2] = rsa_test.key_e[1];
	rsa_temp[3] = rsa_test.key_e[0];
	err = sprd_rsa_key_gen(rsa_temp, 4,
			rsa_test.data_len,
			rsa_test.key_n, rsa_test.key_d);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("multi task %d: sprd_rsa_key_gen test failed [0x%x]\n", thread_count, err);
		return err;
	}

failed:
	return err;
}
#endif

#ifdef SPRD_TEST_MULTITHREAD
sprd_crypto_err_t
sprd_multithread_test (void) {
	sprd_pal_thread_t *thread0, *thread1, *thread2, *thread3, *thread4, *thread5,
			*thread6, *thread7, *thread8, *thread9;
	int32_t thread_id0 = 0, thread_id1 = 1, thread_id2 = 2, thread_id3 = 3, thread_id4 = 4,
			thread_id5 = 5,	thread_id6 = 6, thread_id7 = 7, thread_id8 = 8, thread_id9 = 9;
	int32_t retcode0, retcode1, retcode2, retcode3, retcode4, retcode5, retcode6, retcode7, retcode8, retcode9;

	thread0 = sprd_pal_thread_create("sprd_multithread_test_0", sprd_multitask_test, &thread_id0, 20, 4096);
	thread1 = sprd_pal_thread_create("sprd_multithread_test_1", sprd_multitask_test, &thread_id1, 20, 4096);
	thread2 = sprd_pal_thread_create("sprd_multithread_test_2", sprd_multitask_test, &thread_id2, 20, 4096);
	thread3 = sprd_pal_thread_create("sprd_multithread_test_3", sprd_multitask_test, &thread_id3, 20, 4096);
	thread4 = sprd_pal_thread_create("sprd_multithread_test_4", sprd_multitask_test, &thread_id4, 20, 4096);
	thread5 = sprd_pal_thread_create("sprd_multithread_test_5", sprd_multitask_test, &thread_id5, 20, 4096);
	thread6 = sprd_pal_thread_create("sprd_multithread_test_6", sprd_multitask_test, &thread_id6, 20, 4096);
	thread7 = sprd_pal_thread_create("sprd_multithread_test_7", sprd_multitask_test, &thread_id7, 20, 4096);
	thread8 = sprd_pal_thread_create("sprd_multithread_test_8", sprd_multitask_test, &thread_id8, 20, 4096);
	thread9 = sprd_pal_thread_create("sprd_multithread_test_9", sprd_multitask_test, &thread_id9, 20, 4096);


	sprd_pal_thread_resume(thread0);
	sprd_pal_thread_resume(thread1);
	sprd_pal_thread_resume(thread2);
	sprd_pal_thread_resume(thread3);
	sprd_pal_thread_resume(thread4);
	sprd_pal_thread_resume(thread5);
	sprd_pal_thread_resume(thread6);
	sprd_pal_thread_resume(thread7);
	sprd_pal_thread_resume(thread8);
	sprd_pal_thread_resume(thread9);

	sprd_pal_thread_join(thread0, &retcode0, SPRD_PAL_INFINITE_TIME);
	sprd_pal_thread_join(thread1, &retcode1, SPRD_PAL_INFINITE_TIME);
	sprd_pal_thread_join(thread2, &retcode2, SPRD_PAL_INFINITE_TIME);
	sprd_pal_thread_join(thread3, &retcode3, SPRD_PAL_INFINITE_TIME);
	sprd_pal_thread_join(thread4, &retcode4, SPRD_PAL_INFINITE_TIME);
	sprd_pal_thread_join(thread5, &retcode5, SPRD_PAL_INFINITE_TIME);
	sprd_pal_thread_join(thread6, &retcode6, SPRD_PAL_INFINITE_TIME);
	sprd_pal_thread_join(thread7, &retcode7, SPRD_PAL_INFINITE_TIME);
	sprd_pal_thread_join(thread8, &retcode8, SPRD_PAL_INFINITE_TIME);
	sprd_pal_thread_join(thread9, &retcode9, SPRD_PAL_INFINITE_TIME);

	if (retcode0 == 0
		&& retcode1 == 0
		&& retcode2 == 0
		&& retcode3 == 0
		&& retcode4 == 0
		&& retcode5 == 0
		&& retcode6 == 0
		&& retcode7 == 0
		&& retcode8 == 0
		&& retcode9 == 0
		) {
		return SPRD_CRYPTO_SUCCESS;
	} else {
		SPRD_CRYPTO_LOG_ERR("retcode0 = %d,retcode1 = %d, retcode2 = %d,retcode3 = %d, retcode4 = %d,"
				"retcode5 = %d, retcode6 = %d, retcode7 = %d, retcode8 = %d,retcode9 = %d\n",
				retcode0, retcode1, retcode2, retcode3, retcode4,
				retcode5, retcode6, retcode7, retcode8, retcode9);
		return SPRD_CRYPTO_ERR_RESULT;
	}
}
#endif

sprd_crypto_err_t sprd_crypto_test (void) {
	sprd_crypto_err_t err = SPRD_CRYPTO_SUCCESS;
	int32_t i = 0;

	SPRD_CRYPTO_LOG_ERR("test ERR\n");
	SPRD_CRYPTO_LOG_WARN("test WARN\n");
	SPRD_CRYPTO_LOG_DEBUG("test DEBUG\n");
	SPRD_CRYPTO_LOG_TRACE("test TRACE\n");
	SPRD_CRYPTO_LOG_ERR("test ERR\n");

	SPRD_CRYPTO_LOG_ERR("test ERR = %d\n", i++);
	SPRD_CRYPTO_LOG_WARN("test WARN = %d\n", i++);
	SPRD_CRYPTO_LOG_DEBUG("test DEBUG = %d\n", i++);
	SPRD_CRYPTO_LOG_TRACE("test TRACE = %d\n", i++);
	SPRD_CRYPTO_LOG_ERR("test ERR = %d\n", i++);

#ifdef SPRD_TEST_HASH
	int32_t hash = 0;
#endif
#ifdef SPRD_TEST_RSA
	int32_t rsa = 0;
#endif
#ifdef SPRD_TEST_AES
	int32_t aes = 0;
#endif
#ifdef SPRD_TEST_RNG
	int32_t rng = 0;
#endif
#ifdef SPRD_TEST_HMAC
	int32_t hmac = 0;
#endif
#ifdef SPRD_TEST_CMAC
	int32_t cmac = 0;
#endif
#ifdef SPRD_TEST_AUTHENC
	int32_t authenc = 0;
#endif
#ifdef SPRD_TEST_ECC
	int32_t ecc = 0;
#endif
#ifdef SPRD_TEST_MULTITASK
	int32_t multitask = 0;
	int32_t thread_id = 0;
#endif
#ifdef SPRD_TEST_MULTITHREAD
	int32_t multithread = 0;
#endif

#ifdef SPRD_TEST_HASH
	err = sprd_hash_test();
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("****sprd_hash_test FAILED!****\n");
		goto failed;
	} else {
		hash = 1;
	}
#endif

#ifdef SPRD_TEST_RSA
	err = sprd_rsa_test();
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("****sprd_rsa_test FAILED!****\n");
		goto failed;
	} else {
		rsa = 1;
	}
#endif

#ifdef SPRD_TEST_AES
	err = sprd_aes_test();
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("****sprd_aes_test FAILED!****\n");
		goto failed;
	} else {
		aes = 1;
	}
#endif

#ifdef SPRD_TEST_RNG
	err = sprd_rng_test();
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("****sprd_rng_test FAILED!****\n");
		goto failed;
	} else {
		rng = 1;
	}
#endif

#ifdef SPRD_TEST_HMAC
	err = sprd_hmac_test();
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("****sprd_hmac_test FAILED!****\n");
		goto failed;
	} else {
		hmac = 1;
	}
#endif

#ifdef SPRD_TEST_CMAC
	err = sprd_cmac_test();
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("****sprd_cmac_test FAILED!****\n");
		goto failed;
	} else {
		cmac = 1;
	}
#endif

#ifdef SPRD_TEST_AUTHENC
	err = sprd_authenc_test();
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("****sprd_authenc_test FAILED!****\n");
		goto failed;
	} else {
		authenc = 1;
	}
#endif

#ifdef SPRD_TEST_ECC
	err = sprd_ecc_test();
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("****sprd_ecc_test FAILED!****\n");
		goto failed;
	} else {
		ecc = 1;
	}
#endif

#ifdef SPRD_TEST_MULTITASK
	err = sprd_multitask_test((void*)&thread_id);
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("****sprd_multitask_test FAILED!****\n");
		goto failed;
	} else {
		multitask = 1;
	}
#endif

#ifdef SPRD_TEST_MULTITHREAD
	err = sprd_multithread_test();
	if (err != SPRD_CRYPTO_SUCCESS) {
		SPRD_CRYPTO_LOG_ERR("****sprd_multithread_test FAILED!****\n");
		goto failed;
	} else {
		multithread = 1;
	}
#endif

failed:
#ifdef SPRD_TEST_HASH
	if (hash == 1) {
		SPRD_CRYPTO_LOG_WARN("sprd_hash_test pass!\n");
	}
#endif

#ifdef SPRD_TEST_RSA
	if (rsa == 1) {
		SPRD_CRYPTO_LOG_WARN("sprd_rsa_test pass!\n");
	}
#endif

#ifdef SPRD_TEST_AES
	if (aes == 1) {
		SPRD_CRYPTO_LOG_WARN("sprd_aes_test pass!\n");
	}
#endif

#ifdef SPRD_TEST_RNG
	if (rng == 1) {
		SPRD_CRYPTO_LOG_WARN("sprd_rng_test pass!\n");
	}
#endif

#ifdef SPRD_TEST_HMAC
	if (hmac == 1) {
		SPRD_CRYPTO_LOG_WARN("sprd_hmac_test pass!\n");
	}
#endif

#ifdef SPRD_TEST_CMAC
	if (cmac == 1) {
		SPRD_CRYPTO_LOG_WARN("sprd_cmac_test pass!\n");
	}
#endif

#ifdef SPRD_TEST_AUTHENC
	if (authenc == 1) {
		SPRD_CRYPTO_LOG_WARN("sprd_authenc_test pass!\n");
	}
#endif

#ifdef SPRD_TEST_ECC
	if (ecc == 1) {
		SPRD_CRYPTO_LOG_WARN("sprd_ecc_test pass!\n");
	}
#endif

#ifdef SPRD_TEST_MULTITASK
	if (multitask == 1)  {
		SPRD_CRYPTO_LOG_WARN("sprd_multitask_test pass!\n");
	}
#endif

#ifdef SPRD_TEST_MULTITHREAD
	if (multithread == 1) {
		SPRD_CRYPTO_LOG_WARN("sprd_multithread_test pass!\n");
	}
#endif

	return err;
}


